# !/usr/bin/env python
# -*-coding:utf-8 -*-

"""
# File       : mygo.js.py
# Time       ：2024/9/27 14:35
# Author     ：luoyuqi
# version    ：python 3.11.2
# Description：
"""

from pathlib import Path
from typing import Optional, Dict

from nicegui import ui, app

_RESOURCE = Path(__file__).parent / "libs"

app.add_static_file(local_file=_RESOURCE / "mygo.css", url_path="/mygo.css")

_css_link_tag = f'<link rel="stylesheet" href="/mygo.css">'


class MyGo(ui.element, component="mygo.js"):
    def __init__(self, options: Optional[Dict] = None) -> None:
        """SignaturePad

        An element that integrates the `Signature Pad library <https://szimek.github.io/signature_pad/>`_.
        """
        super().__init__()
        self._props["options"] = options or {}
        self._props["selfId"] = f"c{self.id}"
        self.classes("w-full h-[80vh]")
        # self.add_resource(_RESOURCE)

        ui.add_head_html(_css_link_tag)
